﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Área Administrativa</title>
<link href="css/esqueceu_senha.css" rel="stylesheet" type="text/css" />

<script src="js/jquery-1-4-3-min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function () {
	
	$('#email-background-form-input-email').val('Email').css('color', '#999');
	$('#email-background-form-input-email').css('font-style', 'italic');
	$('#email-background-form-input-email').css('font-size', '13px');
	$('#email-background-form-input-email').css('font-family', 'Verdana, Arial');
	
	$('#email-background-form-input-email').focus(function () {
		if($(this).val() == 'Email') {
			$(this)	.css('color', '').val('');
		}
		
	}).blur(function() {
		if($(this).val() == '') {
			$(this).css('color', '#999').val('Email');
		}	
	});
	
	
	//--------------------------------------------------
	function checkMail(mail){
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	if(typeof(mail) == "string"){
		if(er.test(mail)){ return true; }
	}else if(typeof(mail) == "object"){
		if(er.test(mail.value)){ 
					return true; 
				}
	}else{
		return false;
		}
}
	
	//Inicio evento para enviar email		
	$('#email-background-form-botao-enviar').click( function () {		
		var email   =  $('#email-background-form-input-email').val();
			
		if (!checkMail(email)) {
			$('#email').focus();
			$('.mensagem').text("E-mail inválido.");
			$('#painel-info').show().fadeOut(3000);	
		} else {
			$('.loading').show();
			
			$.post("sistema/recuperar_senha.php",
				{email: email},
				function(valor){
					$('.loading').hide();
					$('#painel-info').show();	
			   		$(".mensagem").text(valor);
				}
	  		)
		}
	}); //FIM de $('#email-background-form-botao-enviar').click( function () {});
			
});

</script>

</head>

<body>
	<div id="distance"></div> <!-- fim distance -->
		
        <div id="container">
 			
            <div id="email-background">
            	<div id="email-background-form">
                	<div>&nbsp;</div>
                <form name="form-esqueceu-senha" method="post">
                	
                    <div id="email">esqueceu seus dados de acesso? fique tranquilo! informe seu e-mail abaixo</div>
                    <input type="text" id="email-background-form-input-email" />
                    <div>
                    	<div id="email-background-form-esqueceu-senha"><a href="login">voltar ao login</a></div>
                        <input type="button" id="email-background-form-botao-enviar" name="Enviar" value="Enviar"/>
                    </div>
                </form>
                
                </div><!-- fim email-background-form -->
            </div><!-- fim email-background -->
            
            <div class="loading">
				<p><img src="images/loading.gif" width="16" height="16" alt="&nbsp;"/>&nbsp;<strong>Enviando</strong></p>
			</div>
            
            <div id="painel-info">                
                <div id="painel-info-mensagem">
                    <p class="mensagem"></p><!--A mensagem aki vai ser inserida via jquery-->
                </div>
            </div>
            
		</div><!-- fim container -->       

</body>
</html>